home *** CD-ROM | disk | FTP | other *** search
- <!--- This example shows how to utilize CFSEARCH
- to search an existing, populated collection --->
-
- <!--- If the collection cannot be found, use the CFCOLLECTION
- example to create a collection named "Snippets" --->
- <HTML>
- <HEAD>
- <TITLE>CFSEARCH Example</TITLE>
- </HEAD>
-
- <BASEFONT FACE="Arial, Helvetica" SIZE=2>
- <BODY bgcolor="#FFFFD5">
-
- <H3>CFSEARCH Example</H3>
- <P>The is a read-only example. Because accessing a collection is
- a sensitive area, consider the security of your collection
- prior to allowing any form of access to it. </P>
-
- <!---
- <P>
- If you are not running a local CF Server, you will need to change
- localhost (in the URLPATH attribute) to your server name. Additionally,
- if the collection cannot be found, use the CFCOLLECTION
- example to create a collection named "Snippets".
- <HR>
- <P>To index the collection, select the check box
- on the form.
- <CFIF IsDefined("form.IndexCollection")>
- <!--- You may need to modify KEY to point to the snippets location.
- If you are not running a local CF Server, you will need to change
- localhost (in the URLPATH attribute) to your server name --->
- <CFINDEX ACTION="UPDATE" COLLECTION="Snippets"
- KEY="#GetDirectoryFromPath(GetTemplatePath())#" TYPE="PATH"
- TITLE="Update Snippets Index"
- URLPATH="http://localhost/cfdocs/snippets/" EXTENSIONS=".cfm" RECURSE="Yes">
- <H3>Collection indexed</H3>
- </CFIF>
-
- <CFIF IsDefined("form.source") AND
- IsDefined("form.type") AND IsDefined("form.searchstring")>
-
- <!--- actually conduct the search --->
- <CFSEARCH NAME="SearchSnippets"
- COLLECTION="#form.source#"
- TYPE="#form.type#"
- CRITERIA="#form.searchstring#">
- <!--- print out the search results --->
- <CFOUTPUT>
- <H2>#form.type# Search Results</H2>
- <P>#SearchSnippets.RecordCount# "hit<CFIF SearchSnippets.recordcount is not 1>s</CFIF>" found
- out of #SearchSnippets.RecordsSearched# total record<CFIF SearchSnippets.recordcount is not 1>s</CFIF>
- searched.
- <P><I><B>#form.maxrows# records returned ...</B></I>
- <CFTABLE QUERY="SearchSnippets" MAXROWS="#maxrows#" STARTROW="1" COLHEADERS HTMLTABLE>
- <CFCOL HEADER="SCORE" TEXT="#score#">
- <CFCOL HEADER="TITLE" TEXT="<a href='#url#' target='blank'>#title#</A>">
- <CFCOL HEADER="SUMMARY" TEXT="#summary#">
- </CFTABLE>
- </CFOUTPUT>
- </CFIF>
-
- <!--- form to initiate the search --->
- <FORM ACTION="cfsearch.cfm" METHOD="POST">
- <H3>Simple Search Form</H3>
-
- <P>Collection to Search
- <BR><INPUT TYPE="Text" NAME="source" VALUE="Snippets">
- <P>Type of Search
- <BR><SELECT NAME="type">
- <OPTION value="Simple" SELECTED>Simple Search
- <OPTION value="Explicit">Explicit Search
- </SELECT>
-
- <P>Criteria for Search
- <BR><FONT SIZE="-1">(empty string will return all documents; try "CFINDEX" for your search)</FONT>
- <BR><INPUT TYPE="Text" NAME="SearchString" VALUE="">
-
- <P>Maximum number of records to return:
- <BR><SELECT NAME="maxrows">
- <OPTION VALUE="10" SELECTED>10
- <OPTION VALUE="20">20
- <OPTION VALUE="30">30
- <OPTION VALUE="40">40
- </SELECT>
-
- <P>Check box to index or reindex collection:
- <INPUT TYPE="Checkbox" NAME="IndexCollection">
- <P><INPUT TYPE="Submit" NAME="" VALUE="Index/Search Collection"> <INPUT TYPE="RESET">
- </FORM> --->
-
- </BODY>
- </HTML>
-